<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<#assign base=request.contextPath  />
        <base id="basePath" href="${base}">
		<link rel="stylesheet" type="text/css" href="${base}/js/layui/css/layui.css"/>
		<script src="${base}/js/layui/layui.all.js"></script>
        <script type="text/javascript" src="${base}/js/zhang.js"></script>
        <link rel="stylesheet" href="${base}/css/demo.css" type="text/css">
        <link rel="stylesheet" href="${base}/css/zTreeStyle.css" type="text/css">
        <script type="text/javascript" src="${base}/js/ztree/jquery-1.4.4.min.js"></script>
        <script type="text/javascript" src="${base}/js/ztree/jquery.ztree.core.js"></script>
        <script type="text/javascript" src="${base}/js/zhang.js"></script>
        <script type="text/javascript" src="${base}/js/ztree/jquery.ztree.excheck.js"></script>
        <script type="text/javascript" src="${base}/js/ztree/jquery.ztree.exedit.js"></script>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
    <legend>财务日报</legend>
</fieldset>
<div class="demoTable"style="padding:15px;">
    <button class="layui-btn layui-btn-radius" id="btn2" data-method="offset" type="button" style="background-color: #0092EF;">添加财务日报</button>
    <div class="layui-inline layui-form" style="float:right;">
        <div class="layui-input-inline">
            <select name="interest"  id="sech"  lay-search="">
                <option value="">请选择要搜索的列</option>
                <option value="name">费用名称</option>
                <option value="name">收入现金</option>
                <option value="name">收入银行存款</option>
                <option value="name">支出现金</option>
                <option value="name">支出银行存款</option>
                <option value="name">余额</option>
                <option value="name">备注</option>

            </select>
        </div>

        <div class="layui-inline">
            <input class="layui-input" name="id" id="demoReload" autocomplete="off">
        </div>
        <button class="layui-btn layui-btn-radius" id="btn1" data-type="reload" style="background-color: #0092EF;">搜索</button>
    </div>
</div>


<table class="layui-hide" id="test" lay-filter="test"></table>
<script type="text/html" id="barDemo">
    <a class="layui-btn  layui-btn-normal layui-btn-xs" lay-event="edit">详细信息</a>
</script>
<script>
    layui.use(['form', 'layedit', 'laydate','table'], function(){
        var form = layui.form
                ,$ = layui.jquery
                ,layer = layui.layer
                ,layedit = layui.layedit
                ,laydate = layui.laydate
                ,table = layui.table;
  
  table.render({
    elem: '#test'
    ,url:'${base}/financialDaily/selectdaymoney'//Controller层的查询所有数据的路径
    ,toolbar: '#toolbarDemo'
    ,title: '用户数据表'
    ,totalRow: true
    ,cols: [[
		{field:'id', title:'ID', templet:function(val){
                return val.LAY_INDEX
            },width:60,align:'center', field: 'left', unresize: true,}
      ,{field:'createTime', title:'日期',templet:function(val){
                  return DateFormat(val.createTime);
              },align:'center'}
      //,{field:'yesterdayMoney', title:'昨日剩余金额',align:'center'}
      ,{field: 'incomeTotal', title: '收入总计',align:'center'}
      ,{field: 'totalExpenditure', title: '支出总计',align:'center'}
      //,{field: 'incomeMoney', title: '收入金额',align:'center'}
      //,{field: 'typeExpenditure', title: '收入类型',align:'center'}
      //,{field: 'expenditureMoney', title: '支出金额',align:'center'}
      //,{field: 'incomeType', title: '支出类型',align:'center'}
     // ,{field: 'paymentType', title: '支付类型',align:'center'}
      ,{field: 'right', title:'操作', toolbar: '#barDemo',align:'center'}

    ]]
      ,id:'testReload'
     , page: {
                layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
                , theme: '#0092EF'
                , limit: 20
            }
      ,done: function(res, curr, count){
          this.where={};
      }
  });
        $('#btn1').on('click', function(){
            var sechLin=$("#sech").val();
            var whereData={};
        });
        var active = {
            offset: function(othis){
                var type = othis.data('type')
                        ,text = othis.text();
                layer.open({
                    type: 2,

                    title: '添加财务日报档案',
                    offset: 't',
                    area:['720px','500px'],
                    shadeClose:false ,
                    content: '${base}/financialDaily/dayMoney1_add',

                });
            }
        };
        $('#btn2').on('click', function(){
            var othis = $(this), method = othis.data('method');
            active[method] ? active[method].call(this, othis) : '';
        });


        //编辑弹出层
        table.on('tool(test)', function(obj){
            var layEvent = obj.event;
            if(layEvent=="edit"){
                var data = obj.data;

                //示范一个公告层
                layer.open({
                    type: 2,
                    title: '日报详细信息',
                    offset: 't',
                    shadeClose:false ,
                    area:['720px','500px'],
                    content: '${base}/financialDaily/alertDayMoney?createTime='+data.createTime,
                });
            }
        });


        layui.form.on('select()', function(data){
            $("#demoReload").val("")
        });


        //实现搜索
        $('#btn1').on('click', function(){
            var sechLin=$("#sech").val();
            var sechData=$("#demoReload").val();

            var whereData={};
            whereData.lin=sechLin;
            whereData.data=Trim(sechData);
            whereData.page=1;
            whereData.limit=10;
            var table = layui.table;
            //表刷新方法
            table.reload('testReload', {
                url:'${base}/employeeFile/select'
                ,where: whereData //设定异步数据接口的额外参数
            });
        });
        String.prototype.trim = function() {
            return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
        }

        //键盘事件
        $("body").bind("keydown",function(e){
            // 兼容FF和IE和Opera
            var theEvent = e || window.event;
            var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
            if (code == 13) {
                //回车执行查询
                $("#btn1").click();
            }
        });





});
</script>

</body>
</html>